package a.j.a;

import a.c.bb;
import a.c.e;
import a.c.w;
import a.j.g;

import javax.swing.event.TreeModelEvent;
import javax.swing.event.TreeModelListener;
import javax.swing.tree.TreeModel;
import javax.swing.tree.TreePath;
import java.util.*;

public class l
  implements TreeModel
{
  j a;
  ArrayList b;
  Map c;
  Map d;
  Set e;
  e_ f;
  Comparator g;
  boolean h;
  private static final byte i = 0;
  private static final byte j = 1;
  private static final byte k = 2;
  private static final byte l = 3;
  public static boolean m;
  
  public l(j paramj)
  {
    this.a = paramj;
    this.f = new e_(null);
    this.b = new ArrayList();
    this.c = new HashMap();
    this.d = new HashMap();
    this.e = new HashSet();
    paramj.a(this.f);
    a(paramj.j());
  }
  
  public void a()
  {
    this.b = null;
    this.c = null;
    this.d = null;
    this.e = null;
    this.a.b(this.f);
    this.a = null;
    this.f = null;
  }
  
  private void a(a.c.q paramq)
  {
    int n = j.v;
    boolean bool = j.u;
    w localw = paramq.v();
    do
    {
      if (!localw.e()) {
        break;
      }
      e locale = localw.d();
      g(locale);
      if (n == 0)
      {
        if (this.a.l(locale)) {
          a(this.a.o(locale));
        }
        localw.f();
      }
    } while (!bool);
  }
  
  public void a(Comparator paramComparator)
  {
    this.g = paramComparator;
    a(getRoot());
  }
  
  private void a(Object paramObject)
  {
    int n = j.v;
    boolean bool = j.u;
    if ((n != 0) || (d()))
    {
      ArrayList localArrayList = i(paramObject);
      a.i.l.a(localArrayList, this.g);
      Iterator localIterator = localArrayList.iterator();
      do
      {
        if (!localIterator.hasNext()) {
          break;
        }
        a(localIterator.next());
      } while (!bool);
    }
  }
  
  public Comparator b()
  {
    return this.g;
  }
  
  private boolean d()
  {
    return this.g != null;
  }
  
  private Object c(Object paramObject)
  {
    int n = j.v;
    Object localObject = this.d.get(paramObject);
    if (n == 0) {
      if (localObject == null)
      {
        e locale = (e)paramObject;
        localObject = this.a.p(locale);
        if (n == 0) {
          if (localObject == null) {
            localObject = this.a.j();
          }
        }
        this.d.put(locale, localObject);
      }
    }
    return localObject;
  }
  
  public void addTreeModelListener(TreeModelListener paramTreeModelListener)
  {
    this.b.add(paramTreeModelListener);
  }
  
  public void removeTreeModelListener(TreeModelListener paramTreeModelListener)
  {
    if ((j.v != 0) || (this.b != null)) {
      this.b.remove(paramTreeModelListener);
    }
  }
  
  public Object getChild(Object paramObject, int paramInt)
  {
    return i(paramObject).get(paramInt);
  }
  
  public int getChildCount(Object paramObject)
  {
    return i(paramObject).size();
  }
  
  public int getIndexOfChild(Object paramObject1, Object paramObject2)
  {
    return i(paramObject1).indexOf(paramObject2);
  }
  
  public Object getRoot()
  {
    return this.a.j();
  }
  
  public boolean isLeaf(Object paramObject)
  {
    int n = j.v;
    if (n == 0) {
      if ((paramObject instanceof e))
      {
        e locale = (e)paramObject;
        if (locale.g() == null) {
          return true;
        }
        if (n == 0) {
          if (this.a.m(locale)) {
            return false;
          }
        }
        if (n == 0) {
          if (this.a.l(locale)) {
            return false;
          }
        }
        return true;
      }
    }
    return false;
  }
  
  public void valueForPathChanged(TreePath paramTreePath, Object paramObject)
  {
    int n = j.v;
    boolean bool = j.u;
    Object localObject = paramTreePath.getLastPathComponent();
    if ((n != 0) || ((localObject instanceof e)))
    {
      e locale = (e)localObject;
      if ((n != 0) || ((locale.g() instanceof g)))
      {
        g localg = (g)locale.g();
        localg.a(new bb(locale).l());
        localg.a(locale, paramObject.toString());
        localg.gb();
        j localj = j.a(localg);
        if ((n != 0) || (localj != null))
        {
          locale = localj.f(localg);
          do
          {
            if (locale == null) {
              break;
            }
            ((g)locale.g()).gb();
            locale = localj.f(locale.g());
          } while (!bool);
        }
      }
    }
  }
  
  private int e(Object paramObject)
  {
    return i(c(paramObject)).indexOf(paramObject);
  }
  
  private int g(Object paramObject)
  {
    int i1 = j.v;
    ArrayList localArrayList = i(c(paramObject));
    if (i1 == 0)
    {
      if (d())
      {
        int n = Collections.binarySearch(localArrayList, paramObject, this.g);
        if (i1 == 0)
        {
          if (n < 0) {
            n = -n - 1;
          }
          localArrayList.add(n, paramObject);
        }
        return n;
      }
      localArrayList.add(paramObject);
    }
    return localArrayList.size() - 1;
  }
  
  private int h(Object paramObject)
  {
    ArrayList localArrayList = i(c(paramObject));
    int n = localArrayList.indexOf(paramObject);
    if (j.v == 0) {
      if (n >= 0)
      {
        localArrayList.remove(n);
        this.d.remove(paramObject);
      }
    }
    return n;
  }
  
  private ArrayList i(Object paramObject)
  {
    ArrayList localArrayList = (ArrayList)this.c.get(paramObject);
    if (j.v == 0) {
      if (localArrayList == null)
      {
        localArrayList = new ArrayList();
        this.c.put(paramObject, localArrayList);
      }
    }
    return localArrayList;
  }
  
  void a(e parame)
  {
    int n = j.v;
    g localg = (g)parame.g();
    if (((n != 0) || (localg != null)) && ((n != 0) || (localg.y(parame)))) {
      this.e.add(parame);
    }
  }
  
  void e()
  {
    int n = j.v;
    boolean bool = j.u;
    if (n == 0)
    {
      if (!this.h) {
        this.h = true;
      }
    }
    else {
      try
      {
        Iterator localIterator = this.e.iterator();
        do
        {
          do
          {
            e locale;
            g localg;
            do
            {
              if (!localIterator.hasNext()) {
                break;
              }
              locale = (e)localIterator.next();
              localg = (g)locale.g();
            } while (localg == null);
            localg.a(locale, true);
            if (n != 0) {
              break label108;
            }
            if ((n == 0) && (bool)) {
              return;
            }
          } while (n != 0);
        } while (!bool);
        this.e.clear();
      }
      finally
      {
        label108:
        this.h = false;
      }
    }
  }
  
  public static Comparator f()
  {
    new Comparator()
    {
      public int compare(Object paramAnonymousObject1, Object paramAnonymousObject2)
      {
        return paramAnonymousObject1.toString().compareTo(paramAnonymousObject2.toString());
      }
    };
  }
  
  public static Comparator g()
  {
    new Comparator()
    {
      public int compare(Object paramAnonymousObject1, Object paramAnonymousObject2)
      {
        e locale1 = (e)paramAnonymousObject1;
        e locale2 = (e)paramAnonymousObject2;
        g localg1 = (g)locale1.g();
        g localg2 = (g)locale2.g();
        return localg1.x(locale1).compareTo(localg2.x(locale2));
      }
    };
  }
  
  public static Comparator a(j paramj)
  {
    return new c_(paramj);
  }
  
  static class c_
    implements Comparator
  {
    j a;
    
    c_(j paramj)
    {
      this.a = paramj;
    }
    
    public int compare(Object paramObject1, Object paramObject2)
    {
      int i = j.v;
      e locale1 = (e)paramObject1;
      e locale2 = (e)paramObject2;
      boolean bool1 = this.a.n(locale1);
      boolean bool2 = this.a.n(locale2);
      if (i == 0) {
        if (bool1)
        {
          if (i != 0) {
            break label61;
          }
          if (!bool2) {
            return 1;
          }
        }
      }
      label61:
      if (((i != 0) || (!bool1)) && ((i != 0) || (bool2))) {
        return -1;
      }
      g localg1 = (g)locale1.g();
      String str1 = localg1.x(locale1);
      g localg2 = (g)locale1.g();
      String str2 = localg2.x(locale2);
      if (i == 0) {
        if (bool1 == bool2) {
          return str1.compareTo(str2);
        }
      }
      return 0;
    }
  }
  
  private static final class d_
  {
    TreeModelEvent a;
    byte c;
    
    d_(TreeModelEvent paramTreeModelEvent, byte paramByte)
    {
      this.a = paramTreeModelEvent;
      this.c = paramByte;
    }
    
    void a(ArrayList paramArrayList)
    {
      int j = j.v;
      boolean bool = j.u;
      if ((j != 0) || (paramArrayList != null))
      {
        if (j != 0) {
          break label36;
        }
        if (!paramArrayList.isEmpty()) {}
      }
      else
      {
        return;
      }
      label36:
      TreeModelListener[] arrayOfTreeModelListener = new TreeModelListener[paramArrayList.size()];
      paramArrayList.toArray(arrayOfTreeModelListener);
      if (j == 0) {}
      int i;
      switch (this.c)
      {
      case 2: 
        i = 0;
      }
      while (i < arrayOfTreeModelListener.length)
      {
        arrayOfTreeModelListener[i].treeNodesChanged(this.a);
        i++;
        if (bool)
        {
          i = 0;
          while (i < arrayOfTreeModelListener.length)
          {
            arrayOfTreeModelListener[i].treeNodesInserted(this.a);
            i++;
            if (bool)
            {
              i = 0;
              while (i < arrayOfTreeModelListener.length)
              {
                arrayOfTreeModelListener[i].treeNodesRemoved(this.a);
                i++;
                if (bool)
                {
                  i = 0;
                  while (i < arrayOfTreeModelListener.length)
                  {
                    arrayOfTreeModelListener[i].treeStructureChanged(this.a);
                    i++;
                    if (bool) {
                      throw new IllegalArgumentException("Unknown event type " + this.c);
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
  
  private class e_
    implements i
  {
    private List a = new ArrayList();
    private int b;
    
    private e_() {}
    
    public void a(q paramq)
    {
      int n = j.v;
      boolean bool = j.u;
      if (n == 0) {}
      label357:
      label362:
      Object localObject2;
      label443:
      label445:
      e locale;
      label516:
      label525:
      label537:
      label539:
      Object[] arrayOfObject1;
      int[] arrayOfInt;
      Object[] arrayOfObject2;
      TreeModelEvent localTreeModelEvent;
      switch (paramq.b())
      {
      case 10: 
        this.b += 1;
        if (n == 0) {
          if (!bool) {
            return;
          }
        }
      case 11: 
        this.b -= 1;
        if ((n != 0) || (this.b == 0))
        {
          if (n == 0) {
            if (this.a.size() > 1)
            {
              if (n == 0)
              {
                if (this.a.size() > 500)
                {
                  d(new TreeModelEvent(this, new Object[] { l.this.getRoot() }));
                  if (n != 0) {
                    break label525;
                  }
                }
              }
              else {
                if (!bool) {
                  break label516;
                }
              }
              Object localObject1 = null;
              int j = 0;
              int m = this.a.size();
              if (j < m) {}
              while (n != 0)
              {
                l.d_ locald_ = (l.d_)this.a.get(j);
                Object localObject3 = locald_.a.getTreePath().getLastPathComponent();
                if (n != 0) {
                  break label445;
                }
                if (bool) {
                  break label443;
                }
                if ((n != 0) || ((localObject3 instanceof e)))
                {
                  a.c.q localq = ((e)localObject3).g();
                  if (n == 0) {
                    if (localObject1 == null)
                    {
                      localObject1 = localq;
                      if (n != 0) {
                        break label362;
                      }
                      if (!bool) {
                        break label357;
                      }
                    }
                  }
                  if ((n != 0) || (localq != null))
                  {
                    localObject1 = l.this.a.c((a.c.q)localObject1, localq);
                    if (n != 0) {
                      break label362;
                    }
                    if (!bool) {}
                  }
                }
                else
                {
                  localObject1 = l.this.a.j();
                  continue;
                }
                j++;
                if (!bool) {
                  break;
                }
              }
              if (localObject1 != null)
              {
                Object[] arrayOfObject3 = l.this.a.b(localObject1);
                localObject2 = new TreePath(arrayOfObject3);
                d(new TreeModelEvent(this, (TreePath)localObject2));
                break label516;
              }
              d(new TreeModelEvent(this, new Object[] { l.this.getRoot() }));
              if ((n == 0) && (!bool)) {
                break label516;
              }
            }
          }
          int i = 0;
          int k = this.a.size();
          do
          {
            if (i >= k) {
              break;
            }
            ((l.d_)this.a.get(i)).a(l.this.b);
            i++;
            if (n != 0) {
              break label539;
            }
            if (bool) {
              break label537;
            }
          } while (!bool);
          this.a.clear();
          if (n == 0)
          {
            l.this.e();
            if (!bool) {
              return;
            }
          }
        }
        break;
      case 0: 
        locale = (e)paramq.e();
        arrayOfObject1 = l.this.a.b(locale);
        arrayOfInt = new int[1];
        arrayOfObject2 = new Object[1];
        arrayOfInt[0] = l.this.g(locale);
        arrayOfObject2[0] = locale;
        localTreeModelEvent = new TreeModelEvent(this, arrayOfObject1, arrayOfInt, arrayOfObject2);
        if (n == 0) {
          if (this.b == 0)
          {
            a(localTreeModelEvent);
            if (n == 0) {
              if (!bool) {
                return;
              }
            }
          }
          else
          {
            this.a.add(new l.d_(localTreeModelEvent, (byte)1));
          }
        }
        if (n == 0) {
          if (!bool) {
            return;
          }
        }
      case 1: 
        locale = (e)paramq.e();
        arrayOfObject1 = l.this.a.b(locale);
        arrayOfInt = new int[1];
        arrayOfObject2 = new Object[1];
        arrayOfObject2[0] = locale;
        arrayOfInt[0] = l.this.h(locale);
        l.this.c.remove(locale);
        localTreeModelEvent = new TreeModelEvent(this, arrayOfObject1, arrayOfInt, arrayOfObject2);
        if (n == 0) {
          if (this.b == 0)
          {
            e(localTreeModelEvent);
            if (n == 0) {
              if (!bool) {
                return;
              }
            }
          }
          else
          {
            this.a.add(new l.d_(localTreeModelEvent, (byte)0));
          }
        }
      case 4: 
        if ((n == 0) && ((!bool) || ((n == 0) && (!l.this.d())))) {}
        break;
      case 2: 
        locale = (e)paramq.e();
        arrayOfObject1 = l.this.a.b(locale);
        arrayOfInt = new int[1];
        arrayOfObject2 = new Object[1];
        if (n == 0) {
          if (!l.this.d())
          {
            arrayOfInt[0] = l.this.e(locale);
            arrayOfObject2[0] = locale;
            localTreeModelEvent = new TreeModelEvent(this, arrayOfObject1, arrayOfInt, arrayOfObject2);
            if (n == 0) {
              if (this.b == 0)
              {
                c(localTreeModelEvent);
                if (n == 0) {
                  if (!bool) {
                    return;
                  }
                }
              }
              else
              {
                this.a.add(new l.d_(localTreeModelEvent, (byte)2));
              }
            }
            if (n != 0) {
              break label1001;
            }
            if (!bool) {
              return;
            }
          }
        }
        l.this.a(locale);
        arrayOfInt[0] = l.this.h(locale);
        arrayOfObject2[0] = locale;
        localTreeModelEvent = new TreeModelEvent(this, arrayOfObject1, arrayOfInt, arrayOfObject2);
        if (n == 0) {
          if (this.b == 0)
          {
            e(localTreeModelEvent);
            if (n != 0) {
              break label1091;
            }
            if (!bool) {
              break label1045;
            }
          }
        }
        this.a.add(new l.d_(localTreeModelEvent, (byte)0));
        arrayOfInt = new int[1];
        arrayOfObject2 = new Object[1];
        arrayOfInt[0] = l.this.g(locale);
        arrayOfObject2[0] = locale;
        localTreeModelEvent = new TreeModelEvent(this, arrayOfObject1, arrayOfInt, arrayOfObject2);
        if (n == 0) {
          if (this.b == 0)
          {
            a(localTreeModelEvent);
            l.this.e();
            if (n == 0) {
              if (!bool) {
                return;
              }
            }
          }
          else
          {
            if (n != 0) {
              break label1156;
            }
            this.a.add(new l.d_(localTreeModelEvent, (byte)1));
          }
        }
        if (!bool) {}
        label1456:
        label1468:
        break;
      case 3: 
      case 8: 
        label1001:
        bb localbb = (bb)paramq.e();
        label1045:
        label1091:
        arrayOfObject1 = l.this.a.a(paramq.d(), true);
        label1156:
        localObject2 = localbb.l();
        do
        {
          do
          {
            if (!((w)localObject2).e()) {
              break;
            }
            locale = ((w)localObject2).d();
            l.this.a(locale);
            arrayOfInt = new int[] { l.this.h(locale) };
            arrayOfObject2 = new Object[] { locale };
            localTreeModelEvent = new TreeModelEvent(this, arrayOfObject1, arrayOfInt, arrayOfObject2);
            if (bool) {
              break label1348;
            }
            if (this.b == 0)
            {
              e(localTreeModelEvent);
              if (n != 0) {
                continue;
              }
              if (!bool) {}
            }
            else
            {
              this.a.add(new l.d_(localTreeModelEvent, (byte)0));
            }
            ((w)localObject2).f();
          } while (!bool);
          arrayOfObject1 = l.this.a.b(localbb.m());
        } while (n != 0);
        localObject2 = localbb.l();
        label1348:
        do
        {
          if (!((w)localObject2).e()) {
            break;
          }
          locale = ((w)localObject2).d();
          arrayOfInt = new int[] { l.this.g(locale) };
          arrayOfObject2 = new Object[] { locale };
          localTreeModelEvent = new TreeModelEvent(this, arrayOfObject1, arrayOfInt, arrayOfObject2);
          if (n == 0) {
            if (this.b == 0)
            {
              a(localTreeModelEvent);
              l.this.e();
              if (n != 0) {
                break label1468;
              }
              if (!bool) {
                break label1456;
              }
            }
          }
          this.a.add(new l.d_(localTreeModelEvent, (byte)1));
          if (n == 0)
          {
            if (l.this.a.l(locale)) {
              a(locale);
            }
            ((w)localObject2).f();
          }
        } while (!bool);
      }
    }
    
    private void a(e parame)
    {
      int i = j.v;
      boolean bool = j.u;
      a.c.q localq = l.this.a.o(parame);
      Object[] arrayOfObject1 = l.this.a.b(localq);
      int[] arrayOfInt = new int[1];
      Object[] arrayOfObject2 = new Object[1];
      w localw = localq.v();
      if (localw.e())
      {
        parame = localw.d();
        arrayOfInt[0] = l.this.e(parame);
        arrayOfObject2[0] = parame;
      }
      label149:
      label160:
      while (i != 0)
      {
        TreeModelEvent localTreeModelEvent = new TreeModelEvent(this, arrayOfObject1, arrayOfInt, arrayOfObject2);
        if (i == 0) {
          if (this.b == 0)
          {
            a(localTreeModelEvent);
            if (i != 0) {
              break label160;
            }
            if (!bool) {
              break label149;
            }
          }
        }
        this.a.add(new l.d_(localTreeModelEvent, (byte)1));
        if (i == 0)
        {
          if (l.this.a.l(parame)) {
            a(parame);
          }
          localw.f();
        }
        if (!bool) {
          break;
        }
      }
    }
    
    private void a(TreeModelEvent paramTreeModelEvent)
    {
      int j = j.v;
      boolean bool = j.u;
      if (((j != 0) || (l.this.b != null)) && ((j != 0) || (!l.this.b.isEmpty())))
      {
        TreeModelListener[] arrayOfTreeModelListener = new TreeModelListener[l.this.b.size()];
        l.this.b.toArray(arrayOfTreeModelListener);
        int i = 0;
        do
        {
          if (i >= arrayOfTreeModelListener.length) {
            break;
          }
          arrayOfTreeModelListener[i].treeNodesInserted(paramTreeModelEvent);
          i++;
        } while (!bool);
      }
    }
    
    private void c(TreeModelEvent paramTreeModelEvent)
    {
      int j = j.v;
      boolean bool = j.u;
      if (((j != 0) || (l.this.b != null)) && ((j != 0) || (!l.this.b.isEmpty())))
      {
        TreeModelListener[] arrayOfTreeModelListener = new TreeModelListener[l.this.b.size()];
        l.this.b.toArray(arrayOfTreeModelListener);
        int i = 0;
        do
        {
          if (i >= arrayOfTreeModelListener.length) {
            break;
          }
          arrayOfTreeModelListener[i].treeNodesChanged(paramTreeModelEvent);
          i++;
        } while (!bool);
      }
    }
    
    private void d(TreeModelEvent paramTreeModelEvent)
    {
      int j = j.v;
      boolean bool = j.u;
      if (((j != 0) || (l.this.b != null)) && ((j != 0) || (!l.this.b.isEmpty())))
      {
        TreeModelListener[] arrayOfTreeModelListener = new TreeModelListener[l.this.b.size()];
        l.this.b.toArray(arrayOfTreeModelListener);
        int i = 0;
        do
        {
          if (i >= arrayOfTreeModelListener.length) {
            break;
          }
          arrayOfTreeModelListener[i].treeStructureChanged(paramTreeModelEvent);
          i++;
        } while (!bool);
      }
    }
    
    private void e(TreeModelEvent paramTreeModelEvent)
    {
      int j = j.v;
      boolean bool = j.u;
      if (((j != 0) || (l.this.b != null)) && ((j != 0) || (!l.this.b.isEmpty())))
      {
        TreeModelListener[] arrayOfTreeModelListener = new TreeModelListener[l.this.b.size()];
        l.this.b.toArray(arrayOfTreeModelListener);
        int i = 0;
        do
        {
          if (i >= arrayOfTreeModelListener.length) {
            break;
          }
          arrayOfTreeModelListener[i].treeNodesRemoved(paramTreeModelEvent);
          i++;
        } while (!bool);
      }
    }
    
    e_(l.0 param0)
    {
      this();
    }
  }
}



/* Location:           E:\idea\

 * Qualified Name:     a.j.a.l

 * JD-Core Version:    0.7.0.1

 */